package nickname;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

public abstract class HttpConnectionFactory {
	
	public static HttpURLConnection createHttpConnection(URL url) throws IllegalArgumentException, IOException {
		if (!url.getProtocol().equals("http")) throw new IllegalArgumentException("HTTP URL only");
		HttpURLConnection connection = (HttpURLConnection) url.openConnection();
		connection.setRequestProperty("User-Agent", "mggPlus1.3/android");
		return connection;
	}
}
